﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using System.Runtime.Remoting.Contexts; //上下文特性
using System.Runtime.Remoting.Messaging; //上下文消息接受
using Guoc.DAL.Common;
namespace Guoc.DAL.AOPFilter
{
    [AttributeUsage(AttributeTargets.Class|AttributeTargets.Method, AllowMultiple = false)]
    public class TransactionAttribute :ContextAttribute,IContributeObjectSink
    {
        public TransactionAttribute() : base("Transaction") { }


        public IMessageSink GetObjectSink(MarshalByRefObject obj, IMessageSink nextSink)
        {
            //接受消息，传递给AOPFiler, 程序将进行AOP 切面
            TransactionFilter aopFilter = new TransactionFilter(nextSink);
            return aopFilter;
        }
    }
}
